<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>keyboard event</title>
	</head>
	<body>
		<script>
			document.addEventListener('keydown',fun1);
			function fun1(e){
				var k = e.key;
				var c = e.code;
				console.log("key:"+k+",code:"+c)
			}
		</script>
	</body>
</html>